package org.tacticalTroopers.jme.server.object;

import javax.vecmath.Vector3f;

import org.tacticalTroopers.jme.common.message.Command;
import org.tacticalTroopers.jme.common.message.Element;
import org.tacticalTroopers.jme.server.NetworkClientHandler;
import org.tacticalTroopers.jme.server.team.Team;

public class ServerPlayer extends ServerElement{

	
	
	
	public enum State {LIVE,DEAD};

	Team team;

	Float accel = 0f;
	Float straf = 0f;
	

	Float turn = 0f;
	State state;
	
	Command command = new Command();
	
	Boolean allowedToFire = true;
	
	public ServerPlayer(){
		super();
		setMass(1f);
		setSize(0.5f,0.5f,0.5f);
		element.setType(Element.PLAYER);
	}

	Vector3f directionVector = new Vector3f();
	Vector3f firePosition = new Vector3f();
	
	public Vector3f getFirePosition() {
		firePosition.set(getPosition());
		directionVector.set(-1f,.6f,1f);
		getOriantation().transform(directionVector);
		firePosition.add(directionVector);
		/*
	firePosition.set(getPosition());
	firePosition.add(new Vector3f(0f,2f,0f));
		 */
		return firePosition;
		//return firePosition;
	}

	public Float getStraf() {
		return straf;
	}


	public void setStraf(Float straf) {
		this.straf = straf;
	}

	public Float getAccel() {
		return accel;
	}

	public Float getTurn() {
		return turn;
	}

	public void setAccel(Float f) {
		this.accel = f;
	}

	public void setTurn(Float f) {
		this.turn = f;
	}

	@Override
	public String toString() {
		return "Player "+super.toString();
	}


	public Team getTeam() {
		return team;
	}


	public void setTeam(Team t) {
		this.team=t;
	}

	NetworkClientHandler networkClientHandler;

	
	public NetworkClientHandler getClientHandler() {
		return networkClientHandler;
	}

	public void setNetworkClientHandler(NetworkClientHandler client) {
		this.networkClientHandler = client;
	}

	public void setState(State state) {
		this.state=state;
	}
	
	public State getState() {
		return this.state;
	}
	
	public Command getCommand() {
		return command;
	}

	public Boolean isAllowedTofire(){
		return allowedToFire;
	}
	
	public void setAllowedToFire(Boolean bool){
		allowedToFire=bool;
	}


	
	
}
